import type { PageParams, PageResult } from '@/types/global'
import { http } from '@/utils/http'
import type { SignInItem, SignInParams } from '@/types/signInInfo'
import type { CourseItem, CourseParams } from '@/types/course'
import type { ClassRoomItem, ClassRoomParams } from '@/types/classRoom'
import type { BannerItem, CategoryItem, GuessItem, HotItem } from '@/types/home'
import type { HomeworkItem, HomeworkParams } from '@/types/homework'
import type { StudentLeaveItem, StudentLeaveParams } from '@/types/studentLeave'
import type { ScheduleItem, ScheduleParams } from '@/types/schedule'
import type { ArchiveItem, ArchiveParams } from '@/types/archive'

/**
 * 获取签到列表
 */
export const getSignInList = (params: SignInParams) => {
  return http<PageResult<SignInItem>>({
    method: 'GET',
    url: '/wechat/home/signIn/list',
    data: params,
  })
}

/**
 * 获取成长档案列表
 */
export const getArchiveList = (params: ArchiveParams) => {
  return http<PageResult<ArchiveItem>>({
    method: 'GET',
    url: '/wechat/home/archive/list',
    data: params,
  })
}

/**
 * 获取课程列表
 */
export const getCourseList = (params: CourseParams) => {
  return http<PageResult<CourseItem>>({
    method: 'POST',
    url: '/wechat/home/course/list',
    data: params,
  })
}

/**
 * 获取班级列表
 */
export const getClassRoomList = (params: ClassRoomParams) => {
  return http<PageResult<ClassRoomItem>>({
    method: 'GET',
    url: '/wechat/home/classRoom/list',
    data: params,
  })
}

/**
 * 获取推荐课程列表
 * @param data
 * @returns
 */
export const getRecommendedCoursesAPI = (data?: PageParams) => {
  return http<PageResult<CourseItem>>({
    method: 'GET',
    url: '/wechat/home/recommended/course',
    data,
  })
}

/**
 * 获取作业列表
 * @param data
 * @returns
 */
export const getHomeworkList = (data?: HomeworkParams) => {
  return http<PageResult<HomeworkItem>>({
    method: 'GET',
    url: '/wechat/home/homework/list',
    data,
  })
}

/**
 * 获取请假列表
 * @param data
 * @returns
 */
export const getStudentLeaveList = (data?: StudentLeaveParams) => {
  return http<PageResult<StudentLeaveItem>>({
    method: 'GET',
    url: '/wechat/home/studentLeave/list',
    data,
  })
}

/**
 * 获取日程列表
 * @param data
 * @returns
 */
export const getScheduleList = (data?: ScheduleParams) => {
  return http<PageResult<ScheduleItem>>({
    method: 'POST',
    url: '/wechat/home/schedule/list',
    data,
  })
}

/**
 * 获取当前天的日程列表
 * @returns
 */
export const getCurrentDayScheduleList = () => {
  return http<ScheduleItem[]>({
    method: 'GET',
    url: '/wechat/home/currentDay/schedule',
  })
}
